<?php

namespace App\Http\Middleware;

use App\Models\Websiteconfig;
use Closure;
use Encore\Admin\Facades\Admin;
use Illuminate\Support\Facades\Auth;

class CheckIP
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        return $next($request);
        $allow_ip_list = [
            '127.0.0.1',

        ];

        if (!in_array(get_client_ip(), $allow_ip_list)) {
            Auth::logout();
            flash(translate('ip denied.'))->warning();
            return redirect()->route('home');
        }

        return $next($request);
    }
}
